
package com.cqrcb.cloud;

import com.alibaba.cloud.dubbo.annotation.DubboTransported;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.EnableAutoConfiguration;
import org.springframework.cloud.client.SpringCloudApplication;
import org.springframework.cloud.client.discovery.EnableDiscoveryClient;
import org.springframework.cloud.client.loadbalancer.LoadBalanced;
import org.springframework.cloud.openfeign.EnableFeignClients;
import org.springframework.context.annotation.Bean;
import org.springframework.web.client.RestTemplate;

/**
 * @author lengleng
 */
@EnableFeignClients
@EnableDiscoveryClient
@SpringCloudApplication
@EnableAutoConfiguration
public class ActivityApplication {

//	@NacosValue(value  = "${test.value:}", autoRefreshed = true)
//	private String testValue;

//	@Value(value  = "${test.value:}")
	private String testValue;

	@Autowired
	@LoadBalanced
	private RestTemplate restTemplate;

	@Bean
	@LoadBalanced
	@DubboTransported
	public RestTemplate restTemplate() {
		return new RestTemplate();
	}

	public static void main(String[] args) {
//		System.out.println("1231231231");
//		new SpringApplicationBuilder(ProviderApplication.class)
//				.properties("spring.profiles.active=eureka")
//				.run(args);
		SpringApplication.run(ActivityApplication.class, args);
	}

//	@PostConstruct
//	private void init() throws InterruptedException {
//		new Thread(()->{
//			while (true){
//				try {
//					Thread.sleep(2000);
//				} catch (InterruptedException e) {
//					e.printStackTrace();
//				}
//				System.out.println("testValue--->" + testValue);
//			}
//		}).start();
//	}
}
